<#include "../util/TypeInfo.ftl">
<#if !c2h.isCollection(property) && !isToOne(property) && property != pojo.versionProperty!>
<#if !propertyIsId || property.value.identifierGeneratorStrategy == "assigned">
<#if pojo.isComponent(property) >
<#foreach componentProperty in property.value.propertyIterator>
<#assign column = componentProperty.columnIterator.next()>
            <s:decorate template="layout/edit.xhtml">
                <ui:define name="label">${label(componentProperty.name)}</ui:define>
<#if isDate(componentProperty)>
                <rich:calendar  
<#if !column.nullable>
                       required="true"
</#if>
                          value="${'#'}{${homeName}.instance.${property.name}.${componentProperty.name}}" datePattern="dd.MM.yyyy" locale="tr" >
                          
                          	<s:convertDateTime pattern="dd.MM.yyyy" />
                          </rich:calendar>
<#elseif isTime(componentProperty)>
                <h:inputText size="5"
<#if !column.nullable>
                       required="true"
</#if>
                          value="${'#'}{${homeName}.instance.${property.name}.${componentProperty.name}}">
                    <s:convertDateTime type="time"/>
                </h:inputText>
<#elseif isTimestamp(componentProperty)>
                <rich:calendar id="${componentProperty.name}"
<#if !column.nullable>
                       required="true"
</#if>
                          value="${'#'}{${homeName}.instance.${property.name}.${componentProperty.name}}"  datePattern="dd.MM.yyyy HH:mm" locale="tr" >
                          
                          	<s:convertDateTime pattern="dd.MM.yyyy HH:mm" />
                          </rich:calendar>
<#elseif isBigDecimal(componentProperty)>
                <h:inputText id="${componentProperty.name}"
<#if !column.nullable>
                       required="true"
</#if>
                          value="${'#'}{${homeName}.instance.${property.name}.${componentProperty.name}}"
                           size="${column.precision+7}" />
<#elseif isBigInteger(componentProperty)>
                <h:inputText id="${componentProperty.name}"
<#if !column.nullable>
                       required="true"
</#if>
                          value="${'#'}{${homeName}.instance.${property.name}.${componentProperty.name}}"
                           size="${column.precision+6}" />
<#elseif isBoolean(componentProperty)>
                 <h:selectBooleanCheckbox id="${componentProperty.name}"
<#if !column.nullable>
                                    required="true"
</#if>
                                       value="${'#'}{${homeName}.instance.${property.name}.${componentProperty.name}}"/>
<#elseif isString(componentProperty)>
<#if column.length gt 500>
                <h:inputTextarea cols="80" rows="5"
<#if !column.nullable>
                           required="true"
</#if>
                              value="${'#'}{${homeName}.instance.${property.name}.${componentProperty.name}}"/>
<#else>
<#if column.length gt 100>
<#assign size = 100>
<#else>
<#assign size = column.length>
</#if>
                <h:inputText id="${componentProperty.name}"
<#if !column.nullable>
                      required="true"
</#if>
                     maxlength="${column.length}"
                         value="${'#'}{${homeName}.instance.${property.name}.${componentProperty.name}}" />
</#if>
<#else>
                <h:inputText id="${componentProperty.name}"
<#if !column.nullable>
                       required="true"
</#if>
                          value="${'#'}{${homeName}.instance.${property.name}.${componentProperty.name}}" />
</#if>
            </s:decorate>
			
</#foreach>       
<#else>
<#assign column = property.columnIterator.next()>
<#assign property = property.value.typeName>
            <s:decorate template="layout/edit.xhtml">
                <ui:define name="label">${label(property.name)}</ui:define>
<#if isDate(property)>
                <rich:calendar id="${property.name}"
<#if !column.nullable>
                       required="true"
</#if>
                          value="${'#'}{${homeName}.instance.${property.name}}" datePattern="dd.MM.yyyy" locale="tr" >
                          <s:convertDateTime pattern="dd.MM.yyyy" />
                 </rich:calendar>
<#elseif isTime(property)>
                <h:inputText id="${property.name}"
                           size="5"
<#if !column.nullable>
                       required="true"
</#if>
                          value="${'#'}{${homeName}.instance.${property.name}}">
                    <s:convertDateTime pattern="dd.MM.yyyy HH:mm" />
                </h:inputText>
<#elseif isTimestamp(property)>
                <rich:calendar id="${property.name}"
<#if !column.nullable>
                       required="true"
</#if>
                          value="${'#'}{${homeName}.instance.${property.name}}"  datePattern="dd.MM.yyyy HH:mm" locale="tr" >
                          	<s:convertDateTime pattern="dd.MM.yyyy HH:mm" />
                          </rich:calendar>
<#elseif isBigDecimal(property)>
                <h:inputText id="${property.name}"
<#if !column.nullable>
                       required="true"
</#if>
                          value="${'#'}{${homeName}.instance.${property.name}}"
                           size="${column.precision+7}" />
<#elseif isBigInteger(property)>
                <h:inputText id="${property.name}"
<#if !column.nullable>
                       required="true"
</#if>
                          value="${'#'}{${homeName}.instance.${property.name}}"
                           size="${column.precision+6}" />
<#elseif isBoolean(property)>
                <h:selectBooleanCheckbox id="${property.name}"
<#if !column.nullable>
                                   required="true"
</#if>
                                      value="${'#'}{${homeName}.instance.${property.name}}"/>
<#elseif isString(property)>
<#if column.length gt 500>
                <h:inputTextarea id="${property.name}" cols="80" rows="5"
<#if !column.nullable>
                           required="true"
</#if>
                              value="${'#'}{${homeName}.instance.${property.name}}"/>
<#else>
<#if column.length gt 100>
<#assign size = 100>
<#else>
<#assign size = column.length>
</#if>
                <h:inputText id="${property.name}"
<#if !column.nullable>
                       required="true"
</#if>
                      maxlength="${column.length}"
                          value="${'#'}{${homeName}.instance.${property.name}}" />
</#if>
<#else>
                <h:inputText id="${property.name}"
<#if !column.nullable>
                       required="true"
</#if>
                          value="${'#'}{${homeName}.instance.${property.name}}" />
</#if>
            </s:decorate>
			
</#if>
</#if>
<#elseif c2h.isManyToOne(property)>
<#assign column = property.columnIterator.next()>
<#assign property = property.value.typeName>
<#assign parentPojo = c2j.getPOJOClass(cfg.getClassMapping(property.value.referencedEntityName))>
<#assign parentPageName = parentPojo.shortName?uncap_first>
			<s:decorate template="layout/edit.xhtml">
			   <ui:define name="label">${label(property.name)}</ui:define>
			   <h:selectOneMenu value="${'#'}{${homeName}.instance.${property.name}}" <#if !column.nullable>required="true"</#if> >
				  <s:selectItems var="${parentPageName}" value="${'#'}{${parentPageName}List.resultList}" label="${'#'}{${parentPageName}.ad}" noSelectionLabel="${parentPageName} seciniz"/>
				  <s:convertEntity />
			   </h:selectOneMenu>    
			</s:decorate>
			
<#elseif c2h.isManyToMany(property)>
<#assign column = property.value.element.columnIterator.next()>
<#assign property = property.value.element>
<#assign parentPojo = c2j.getPOJOClass(cfg.getClassMapping(property.value.element.referencedEntityName))>
<#assign parentPageName = parentPojo.shortName?uncap_first>
			<s:decorate template="layout/edit.xhtml">
			   <ui:define name="label">${label(property.name)}</ui:define>
			   <h:selectManyCheckbox value="${'#'}{${homeName}.instance.${property.name}}" <#if !column.nullable>required="true"</#if> >
				  <s:selectItems var="${parentPageName}" value="${'#'}{${parentPageName}List.resultList}" label="${'#'}{${parentPageName}.ad}" />
				  <s:convertEntity />
			   </h:selectManyCheckbox>    
			</s:decorate>
    
</#if>